﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class SiteNavigation_IncludeLog : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string strPage = Request["page"];
            int page = 1;
            try
            {
                page = int.Parse(strPage);
                if (page < 1)
                {
                    page = 1;
                }
            }
            catch (Exception ex)
            {
                page = 1;
            }
            bd(page);
        }
        
    }

    public int GetPage()
    {
        return AspNetPager1.CurrentPageIndex;
    }

    void bd(int page)
    {

        CMSModel.CMSEntities dal = DAL.DBManager.GetCmsEmtity();
        var c = dal.UrlCollect.OrderByDescending(a => a.CreateTime).AsQueryable();
        //.OrderBy(x => "id")
        AspNetPager1.RecordCount = c.Count();
        AspNetPager1.CurrentPageIndex = page;
        c = c.Skip((page - 1) * AspNetPager1.PageSize).Take(AspNetPager1.PageSize);

        Repeater1.DataSource = c;
        Repeater1.DataBind();


    }
    protected void AspNetPager1_PageChanged(object sender, EventArgs e)
    {
        bd(AspNetPager1.CurrentPageIndex);
    }
    //protected void btnDel_Click(object sender, EventArgs e)
    //{
    //    var list = hidIds.Value.Split(',');
    //    //string strID = OTO.ToStr(Request["chkID"]);
    //    //Response.Redirect("NewsList.aspx?strID=" + strID + "&ac=del");
    //    //Response.End();
    //}
}